package com.cyj.mongodbcomment.cyj.pojo;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.index.CompoundIndex;
import org.springframework.data.mongodb.core.mapping.Document;

@Data
@NoArgsConstructor
@AllArgsConstructor
@Document(collection = "comment")
@CompoundIndex( def = "{'userid': 1, 'nickname': -1}") //复合索引
public class Comment {
    @Id
    private String _id;
    private String articleid;//文章ID
    private String content;//评论内容
    private String userid;
    private String nickname;//评论人
    //@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private String createdatetime;//评论时间
    private Integer likenum;//点赞数
    private Integer replynum;//回复数
    private String state;//状态
    private String parentid;//父级id
}
